package scu.maqiang.homogenization;

public class PEL2FineSolution {

	public static void main(String[] args) {
//		long begin = System.nanoTime();
//		int N = 128;
//		double eps = 1.0 / N;
//		Mesh1L2Generator mg = new Mesh1L2Generator();
//		Mesh1DL2 fineMesh = mg.line(0, 1, 32768);
//		ScalarFunc fineRegionFunc1D = (x, llable, param) -> {
//			double cellX = x[0] * N - (int)(x[0] * N);
//			return Math.abs(cellX - 0.5) < 0.25?1.0:-1.0;
//		};
//		fineMesh.setDomainLabel(fineRegionFunc1D, null, 10);
//
//		FES1L2PE fs = new FES1L2PE(fineMesh);
//		SRMatrix A = new SRMatrix(fs.GetNdof());
//		double[] RHS = new double[fs.GetNdof()];
//
//		ScalarFunc CellG1 = (xyz, label, param) -> label == 10? 200: 4;
//		ScalarFunc CellEp1 = (xyz, label, param) -> label == 10? 1.0: 0.02;
//		ScalarFunc CellE1 = (xyz, label, param) -> label == 10? 5.0: 0.3;
//		ScalarFunc Cellrho = (xyz, label, param) -> label == 10? 1: 0.02;
//		ScalarFunc Cellf1 = (xyz, label, param) -> label == 10? 1: 1;
//		ScalarFunc Cellrf = (xyz, label, param) -> label == 10? 1: 1;
//		fs.assemblePEStiff(new ScalarFunc[] {CellG1, CellEp1, CellE1}, null, BVPType.COMMON, A);
//		double f1 = 1.0, rhof = 2.0;
//		fs.assemblePESource(new double[] {f1, rhof}, BVPType.COMMON, RHS);
//		double[] x = new double[fs.GetNdof()];
//		fs.applyBC_MBN(A, Direct.All, 1);
//		fs.applyBC_MBN(RHS, Direct.All, 0.0, 1);
//		DirectSSolver dsolver = new DirectSSolver(A, fs.getnBand());
//		dsolver.PLUSolve(RHS, x, 1);
//
//
//		double[][] u = new double[2][fineMesh.getNv()];
//		fs.extractComponent(x, u);
//
//		fineMesh.toTecplot("PEFineSolution.dat", u);
	}

}
